package com.indexingsystem.boss.utils;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import org.apache.log4j.PropertyConfigurator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.indexingsystem.boss.logback.LogCvt;

public class InstitutionLoadUtils {
	private static final Logger		logger	= LoggerFactory.getLogger( InstitutionLoadUtils.class );
	public final static String		NEWLINE	= System.getProperty( "line.separator", "\n" );
	public final static Properties	table	= new Properties();

	static {
		try {
			table.load( LogCvt.class.getClassLoader().getResourceAsStream( "application.properties" ) );
			PropertyConfigurator.configure( table );
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static String getString(String key) {
		return table.getProperty( key );
	}

	public static Map<String, String> getAll() {
		Map<String, String> map = new HashMap<String, String>( (Map) table );
		return map;
	}

	public static void main(String[] args) {
		System.out.println( InstitutionLoadUtils.getString( "institutionId" ) );
		System.out.println( InstitutionLoadUtils.getAll() );
	}
}
